/**
 * by fq
 * 2019-05-24
 */
// import { fsHost } from '@/config';
// import sha1 from 'js-sha1';
import { upload as uploadImage } from '@/api/article'
/**
 * 文件上传
 * @param {file} file 文件
 */
var _upload = function(file) {
  var p = new Promise(function(ok, error) {
    const form = new FormData()
    form.append('code', file)
    uploadImage(form).then(res => {
      console.log(res)
      ok(res)
    }).catch(err => {
      error(err)
    })
  })
  return p
}

export const upload = _upload
